version 13.0

log using "C:\Users\jcfrankl\Documents\research\polrep\HRonMarchresult1", replace
use "C:\Users\jcfrankl\Documents\research\polrep\data\HRonMarch_ISQ.dta", clear
set more off

xtset countrycd year

gen turmoil=destprot+vioprot
gen nonvio=demonst+hunger+strkboy+nvint


gen lahrrev=1-latenthr

gen milaidmln=milaid*1000000
gen milaidpc=milaidmln/population


gen hrgenchalllag=L.hrgenchall
gen cirirevlag=L.cirirev
gen lahrrevlag=L.lahrrev
gen turmoillag=L.turmoil
gen dddemlag=L.dddem
gen iccprlag=L.iccpr
gen nonviolag=L.nonvio
gen cllag=L.cl
gen injudlag=L.injud
gen pts_pollag=L.pts_pol
gen pts_apollag=L.pts_apol
gen hrgencrit=hrgenchalllag*hrcritlag
gen hrchallcrit=hrchalllag*hrcritlag
gen nonviocrit=nonviolag*hrcritlag
gen milaidpclag=L.milaidpc
gen LJIlag=L.LJI
gen trhroslag=L.trhros

sum pts pts_pol pts_apol hrgenchall hrchall nonvio trhros hrcrit rebel turmoil dddem LJI iccpr milaidpc

oprobit pts ptslag hrgenchalllag hrgencrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag , vce (cluster countrycd)
oprobit pts ptslag hrchalllag hrchallcrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag, vce (cluster countrycd)
oprobit pts ptslag nonviolag nonviocrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag, vce (cluster countrycd)

oprobit pts_pol pts_pollag hrgenchalllag hrgencrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag , vce (cluster countrycd)
oprobit pts_pol pts_pollag hrchalllag hrchallcrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag, vce (cluster countrycd)
oprobit pts_pol pts_pollag nonviolag nonviocrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag, vce (cluster countrycd)

oprobit pts_apol pts_apollag hrgenchalllag hrgencrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag , vce (cluster countrycd)
oprobit pts_apol pts_apollag hrchalllag hrchallcrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag, vce (cluster countrycd)
oprobit pts_apol pts_apollag nonviolag nonviocrit rebellag turmoillag dddemlag iccprlag trhroslag hrcritlag LJIlag milaidpclag, vce (cluster countrycd)


xtline pts_pol pts_apol hrgenchall if countrycd==1 , name(fig3, replace)
xtline pts_pol pts_apol hrgenchall if countrycd==3 , name(fig4, replace)
xtline pts_pol pts_apol hrgenchall if countrycd==7 , name(fig5, replace)
xtline pts_pol pts_apol hrgenchall if countrycd==2 , name(fig6, replace)

collapse (mean) pts pts_pol pts_apol , by(year)
tsline pts pts_pol pts_apol , name(fig2, replace)

log close
